package com.neonbacon.snake;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;


public class CreditsActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new CreditsView(this));
	}
	
@Override 
public boolean onKeyDown(int keyCode, KeyEvent event) 
{     if ((keyCode == KeyEvent.KEYCODE_BACK)) {    
	 Intent i = new Intent(CreditsActivity.this, SnakeActivity.class);
     startActivity(i);
}     
return super.onKeyDown(keyCode, event);
}
class CreditsView extends View{
	String[] text = {"Snake for android:","Code by: Jack Patrick + Riche Morris","Art by: Richie Morris"};
	public CreditsView(Context c){
		super(c);
	}
	float scroll_y = 0;
	
	@Override
	public void onDraw(Canvas c){
		super.onDraw(c);
		Paint p = new Paint();
		p.setColor(Color.WHITE);
		int x = 0;
		int y = 0;
		for(String s: text){
			c.drawText(s,x,y+scroll_y,p);
			y+= 10;
		}
		scroll_y+=0.1;
		invalidate();
	}
}
}
